package com.alon.spring01.common.config.pool;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @program: spring01
 * @description: 异步任务组件
 * @author: yulongguang
 * @create: 2019-04-12 11:35
 **/
@Slf4j
@Component
public class AsyncTask {

    @Async("taskExecutor")
    public void doTask(List<Integer> list) {
       long start= System.currentTimeMillis();
        for (int i=0;i<list.size();i++){
            log.info("下标，i"+i);
        }
        long end= System.currentTimeMillis();
       log.info("共用时 end-start：{}",end-start);
    }
}
